<?php 
	$pPageIsPublic = false;
	include '../_common.php';
	$_SESSION["m1"]="highlight";
	$_SESSION["m2"]="highlight-list";
?>
<?php include("header.php"); ?>
<script type="text/javascript">
$().ready(function(){
	$('ul#listin').admin_sortable("highlight");
	
	$('#select-all').checkedToggle('ul#listin');
	
	$('#del').live('click', function(){
		var check = $(this).closest("li").find('input:checkbox');  
		check.attr('checked', true);
		delItemSelected(check);
	});
});

function delItemSelected(btn) {
	var checked = $('ul#listin').find('input:checked');
	
	if (checked.length == 0) {
		Notify('Select a Item.!',1);
		return false;
	} else {
		var items, li;
		if (btn.id == "checked") {
			items = checked.serialize();
			li = checked.closest("li");
		} else {
			items = $(btn).serialize();
			li = $(btn).closest("li");
		}
		
		items = decodeURIComponent(items);
		
		if (! confirm("You going to delete "+ li.length +" items ?")){
			return false;
		} else {
			ajaxAdmin({
				data: items + "&action=item-delete&class=highlight",
				success: function(response) {
					if (response) {
						Notify(response, 0);
						li.fadeOut(300, function(){$(this).remove();});
					}	
				}
			});
		}					
	}
}

</script>
<?php include("sidebar.php"); ?>
<div id="list">
<h2>Highlight List</h2>
<ul id="subnav">
 	<li class="noleft"><input type="checkbox" name="select-all" id="select-all" /><label for="select-all" class="first-check" >Select All</label></li>
	<li ><a href="javascript:void(0);" id="checked" onclick="delItemSelected(this)"  >Delete Selection</a></li>
	<li class="noborder" > <a href="highlight-add.php" class="add"> Add a New Highlight</a></li>
</ul>
<table id="gradient-style" >
	<thead>
		<tr>
    		<th width="85%" >Highlight</th>
    		<th width="15%" >Action</th>
  		</tr>
	</thead>
</table>
<ul id="listin" >
<?php
$objHig = new Highlight();
$objHig ->loadItems(null, "#status like '".$chkstatus."%'");
while($objItem = $objHig ->rNext()):
?>	
	<li id="recordsArray_<?php echo $objItem->id; ?>"><table id="gradient-style">
		<tr>
			<td width="4%" ><input type="checkbox" name="items[]" value="<?php echo $objItem->id;?>" /></td>
    		<td width="81%"  ><strong><?php echo $objItem ->title  ?></strong>
    			<p><?php echo truncate_string(strip_tags($objItem ->description),80) ?></p>
	    		<strong class="note-small" >status: </strong><?php echo $objItem ->status  ?><br/>
    		</td>
    		<td width="15%" >
    			<table>
				  <tr>
				    <td>
				    	<p class="subnav">
	    					<a href="highlight-add.php?id=<?php echo $objItem ->id ?>" > edit  </a>
	    					<a href="javascript:void(0)" id="del" > delete  </a>
	    				</p>
				    </td>
				  </tr>
				</table>    		
    		</td>
  		</tr></table>
  	</li>
<?php endwhile;  ?>  		
</ul>
</div>
<div class="clear"></div>    
<?php include("footer.php"); ?>